/*
 * VertexNode.cpp
 *
 *  Created on: 15/09/2009
 *      Author: mario
 */

#include "VertexNode.h"
#include <typeinfo>

VertexNode::VertexNode() {}

VertexNode::~VertexNode() {
	//std::cout << "Kill vertex node\n";
	delete data;
}

Vertex* VertexNode::getNodeValue() const{
	return this->data;
}

void VertexNode::setNodeValue(Vertex* value) {
	this->data = value;
}

VertexNode::VertexNode(const VertexNode &vertexNode) {
	this->setNext(vertexNode.getNext());
	data = vertexNode.data;
}

VertexNode& VertexNode::operator=(const VertexNode &vertexNode) {
	this->setNext(vertexNode.getNext());
	this->data = vertexNode.data;
	return *this;
}

VertexNode* VertexNode::clone() const {
	return new VertexNode(*this);
}

bool VertexNode::equals(const Node& node) const {
	if (typeid(&node) == typeid(this)) {
		VertexNode& vertexNode = (VertexNode&)node;
		if (this->getNodeValue()->getId().compare(vertexNode.getNodeValue()->getId()) == 0) {
			return true;
		}
	}
	return false;
}

